<?php
class Model_instancia extends CI_Model
{
	
    function obtenInstancias()
    {
        $data=array();
        $q2 = $this->db->select('id_instancia,nombre');
        $q2 = $this->db->get('instancia_instrumento');
        foreach ($q2->result_array() as $row2){
            $data[] = $row2;
        }
        return($data);
    }
	
	function obtenListado($id_instancia)
	{
	
	$data=array();
        
		$this->db->select('extract(day from inicio) dInicio,
  extract(month from inicio) mInicio,
  extract(year from inicio) aInicio,
  extract(day from fin) dFin,
  extract(month from fin) mFin,
  extract(year from fin) aFin,
  numero anyo,
  ciclo');
		$q2 = $this->db->get_where('instancia_instrumento', array('id_instancia' => $id_instancia));
		
		foreach ($q2->result_array() as $row2){
            $data[] = $row2;
        }
        return($data);
	
	
	
	
	}
 
 }